<template>
  <div class="article">
    <!-- 文章内容筛选功能结构 -->
    <el-card>
      <template #header>
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/layout/home' }"
            >首页</el-breadcrumb-item
          >
          <el-breadcrumb-item>内容管理</el-breadcrumb-item>
        </el-breadcrumb>
      </template>
      <el-form label-width="100px">
        <el-form-item label="状态：">
          <el-radio-group v-model="form.status">
            <el-radio :label="null">全部</el-radio>
            <el-radio :label="0">草稿</el-radio>
            <el-radio :label="1">待审核</el-radio>
            <el-radio :label="2">审核通过</el-radio>
            <el-radio :label="3">审核失败</el-radio>
            <el-radio :label="4">已删除</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="频道：">
          <el-select placeholder="请选择" v-model="form.channel_id">
            <el-option :value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="日期：">
          <el-date-picker
            v-model="form.pubdate"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary">筛选</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <!-- 文章列表结构 -->
    <el-card class="articleList">
      <template #header>
        根据筛选条件共查询到 n 条结果：
      </template>
      <el-table :data="tableData">
        <el-table-column label="封面">
          <template>
            <img class="cover" src="#" alt="" />
          </template>
        </el-table-column>
        <el-table-column label="标题" prop="title"></el-table-column>
        <el-table-column label="状态" prop="status"></el-table-column>
        <el-table-column label="发布时间" prop="data"></el-table-column>
        <el-table-column label="阅读数" prop="0"></el-table-column>
        <el-table-column label="评论数" prop="0"></el-table-column>
        <el-table-column label="点赞数" prop="0"></el-table-column>
        <el-table-column label="操作">
          <template>
            <el-button type="primary" icon="el-icon-edit" circle></el-button>
            <el-button type="danger" icon="el-icon-delete" circle></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页导航组件 -->
      <el-pagination
        :current-page="form.page"
        :page-sizes="[1, 5, 10]"
        :page-size="form.per_page"
        layout="total, sizes, prev, pager, next, jumper"
        :total="10"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'Article',
  data () {
    return {
      form: {
        status: null, // 文章状态，0-草稿，1-待审核，2-审核通过，3-审核失败，不传为全部
        channel_id: '', // 不传为全部
        begin_pubdate: '', // 起始时间
        end_pubdate: '', // 截止时间
        page: 1, // 页码 默认为1页
        per_page: 10, // 每页数量 不传为默认10
        pubdate: [] // [起止时间, 截止时间]
      },
      tableData: [] // 文章筛选信息
    }
  }
}
</script>

<style lang="less" scoped>
.article {
  ::v-deep .el-date-editor .el-range-separator {
    padding: 0 !important;
  }
  .articleList {
    margin-top: 30px;
  }
  .cover {
    width: 50px;
  }
}
</style>
